Skip to content

Hide case management for ineligible question types#1230

Open
millerdev wants to merge 3 commits intomasterfrom
dm/case-management-not-allowed
Open

Hide case management for ineligible question types#1230
millerdev wants to merge 3 commits intomasterfrom
dm/case-management-not-allowed

Conversation

@millerdev
Copy link
Copy Markdown
Contributor

@millerdev millerdev commented Apr 24, 2026

Product Description

The Case Management section is now hidden for question types that cannot meaningfully be mapped to case properties. Specifically, the section no longer appears for:

  • Multimedia questions (Audio, Image, Video, etc.)
  • Save to Case questions (the section didn't actually appear, but auto-assign could assign to it)
  • Trigger (label) questions
  • Group-type containers (Group, Repeat, Field List)
  • Questions inside a Repeat group

The "auto-assign case name" action also now correctly skips these ineligible question types when picking the first question to use as the case name, and will insert a new hidden case-name question instead.

Technical Summary

  • Moved the logic that marks question types as caseProperty: { presence: 'notallowed' } out of getMugTypes and into a new postInit hook. This allows caseProperty.presence to be set on SaveToCase, which was not previously possible because the saveToCase plugin comes later in the call stack than caseManagement (depending on configuration).
  • Added an explicit check in getSectionDisplay so that any question whose ancestor chain contains a Repeat returns an empty section. Previously an eligible question inside a Repeat still showed the Case Management UI.
  • Updated autoAssignName so that when the first question is a type where caseProperty is not allowed (no spec or presence !== 'optional'), it inserts a new hidden case-name data node instead of attempting to reuse the ineligible question. Uses getPresence so mug-level overrides are respected.

https://dimagi.atlassian.net/browse/SAAS-19672
https://dimagi.atlassian.net/browse/SAAS-19673

Feature Flag

FORMBUILDER_SAVE_TO_CASE

Safety Assurance

Safety story

This change only affects UI visibility of the Case Management section and which question types can be auto-selected as the case name. The underlying form XML and existing case mappings are unchanged. Existing forms that already have case properties set on now-excluded types will continue to function; the UI simply stops offering new mappings for them.

Automated test coverage

Yes.

Rollback instructions

  • This PR can be reverted after deploy with no further considerations

Mug type augmentation moved from getMugTypes to postInit because
SaveToCase was not present in getMugTypes since it is later in the
list of enabled plugins. That could change, depending on how Vellum is
configured by the host app, so better to put it in a place where all
mug types will always be present.
The old way would break if a mug type used a `presence` function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant